package com.atguigu.gmall.activity.config;

import org.springframework.stereotype.Component;

/**
 * @author: 李旭
 * @create: 2021-07-30 09:54
 *
 *   Redis监听器接收 消息
 **/
@Component
public class MessageReceive {


    //接收到了Redis发出的 消息
    public void receiveMessage(String message){
        //  skuId:1   1:1  "15:1"
        System.out.println("message:" + message);
        message = message.replaceAll("\"","");
        //保存本地缓存中  JUC   读写锁  Map  HashMap   JUC    15:1    Key:15   Value:1
        String[] m = message.split(":");
        CacheHelper.put(m[0],m[1]);
    }
}
